<template>
  <TCollapse title="是否正常损耗">
    <p style="color: red; margin-bottom: 25px">
      *正常损耗无需在财务调整项目成本，非正常损耗需在财务调整项目成本。
    </p>
    <MyForm ref="formRef" v-model="basicPrjDetail" :form-option="formOption" :select-list="dicLists" />
  </TCollapse>
</template>

<script>
import MyForm from "@/components/basic/myForm";
export default {
  name: "ReviewReduceWastage",
  components: { MyForm },
  props: {
    basicPrjDetail: {
      type: Object,
      default: () => ({})
    },
    workDetail: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    showOperate() {
      return (this.$route.query.type === 'todo' && this.workDetail.activityDefID === 'reduce2_cs01') || this.$route.query.status === 'todo'
    },
  },
  data() {
    return {
      queryParams: {},
      dicLists: {
        WASTAGE_TYPE: [
          {
            dictId: "0",
            dictName: "正常损耗",
          },
          {
            dictId: "1",
            dictName: "非正常损耗",
          },
        ],
      },
      formOption: {
        size: "mini",
        inline: true,
        labelWidth: "160px",
        itemData: [
          {
            type: "select",
            prop: "isNormalLoss",
            value: '',
            width: "",
            colSpan: 6,
            label: "是否正常损耗：",
            dicType: "WASTAGE_TYPE",
            clearable: true,
            disabled: false,
            rule: [{ required: true, message: "请选择该项是否为正常损耗" }],
            dicProp: {
              label: "dictName",
              value: "dictId",
            },
          },
        ],
      },
    };
  },
  created() {
    this.formOption.itemData.forEach((item) => {
      item.disabled = !this.showOperate;
    })
  }
};
</script>
<style lang="scss" scoped>
::v-deep .el-form-item__error {
  display: none !important;
}
</style>
<style>
.el-select-dropdown__item {
  width: 100% !important;
}
</style>